package com.sdy.dcsb.biz.service.impl;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sdy.dcsb.biz.mapper.EsbDictionaryMapper;
import com.sdy.dcsb.biz.model.EsbDictionary;
import com.sdy.dcsb.biz.model.EsbInboundParamDic;
import com.sdy.dcsb.biz.model.vo.EsbDictionaryVo;
import com.sdy.dcsb.biz.service.EsbDictionaryService;
import com.sdy.mvc.service.impl.BaseServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.*;

/**
 * <p>
 * 总线实例
 * </p>
 *
 * @author lx
 * @since 2019-09-27
 */
@Slf4j
@Service
public class EsbDictionaryServiceImpl extends BaseServiceImpl<EsbDictionary> implements EsbDictionaryService {
    @Autowired
    private EsbDictionaryMapper dictionaryMapper;


    /**
     * 获取已存在字典信息
     *
     * @param page 分页信息
     * @param name 字典名称
     * @return 字典信息
     */
    @Override
    public IPage<EsbDictionaryVo> getPageData(Page<?> page, String name) {
        return dictionaryMapper.getPageData(page,name);
    }

    /**
     * 获取字典配置详情
     *
     * @param page    分页信息
     * @param dicName 字典名称
     * @return 字典配置详情
     */
    @Override
    public IPage<EsbDictionary> getDetail(Page<?> page, String dicName) {
        return dictionaryMapper.getDetail(page,dicName);
    }

    /**
     * 查询存在字典配置的参数id
     *
     * @return 字典集合
     */
    @Override
    public List<EsbDictionary> getAllParamDic() {
        return dictionaryMapper.getAllParamDic();
    }

    /**
     * 获取封装接口线程中存在的参数字典配置信息
     *
     * @param id 封装接口id
     * @param threadOrder 线程序号
     * @return 参数字典配置信息
     */
    @Override
    public List<EsbInboundParamDic> getExistDictionaryParamId(Integer id, Integer threadOrder) {
        return dictionaryMapper.getExistDictionaryParamId(id,threadOrder);
    }

    /**
     * 批量插入字典配置信息
     *
     * @param list 字典配置信息集合
     * @return 是否成功
     */
    @Override
    public boolean batchSave(List<EsbDictionary> list) {
        return dictionaryMapper.batchSave(list);
    }
}
